yolov5遇到的问题 您所在的位置:网站首页 jacket potato的马铃薯 yolov5遇到的问题

yolov5遇到的问题

2023-06-04 09:13| 来源: 网络整理| 查看: 265

yolov5遇到的问题-在anaconda 虚拟环境中安装pytorch,cuda 问题一:TypeError: vars() argument must have __dict__ attribute问题二:AssertionError: CUDA unavailable, invalid device 0 requested解决方案接下来安装cuda版本的torch---这里我是在线安装 问题:>>> import torch,torch.cuda.is_available()==Falsecmd中检查cuda及cudnn是否成功安装及其版本参考安装pytorch遇到问题: 在anaconda 虚拟环境中安装pytorch一、创建虚拟环境最重要:下图是cuda:11.3对应的pytorch遇到bug该问题解决方法:---亲测有效! 接着执行下面的代码 问题:Exception: You need either charset_normalizer or chardet installed方法需要依赖库chardet或chardet-normalizer支持,尝试在安装requests前先pip install chardet,或使用这样命令安装: python -m pip install requests chardet 问题:RuntimeError: DataLoader worker (pid(s) 19340, 21256, 7988, 8180, 17600, 10208, 14972, 16948) exited unexpectedly问题:OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/.解决办法:=----可以解决!!!!下图中的我的解决不了 问题:TypeError: No loop matching the specified signature and casting was found for ufunc greater解决办法:推荐一个找bug的网站:[https://kaifa.baidu.com/](https://kaifa.baidu.com/)

问题一:TypeError: vars() argument must have dict attribute

解决办法:

问题二:AssertionError: CUDA unavailable, invalid device 0 requested

在这里插入图片描述

cuda不可用报错,现实没有有效的驱动可使用

解决方案

1、测试cuda是否配置正确 1)在终端输入

python3

import torch print(torch.cuda.is_available()) 在这里插入图片描述 运行后输出的是False,说明cuda有问题。 继续找问题:有可能是pytorch的版本是cpu版本不是cuda版本的!

在这里插入图片描述 方法:查看torch的版本:

python import torch print(torch.version) 1.13.1+cpu

在这里插入图片描述

接下来安装cuda版本的torch—这里我是在线安装

1:查看cuda版本:nvidia-smi【注意这不是查看anaconda中的cuda版本】

nvidia-smi

在这里插入图片描述 查看anaconda环境中cuda的版本号: nvcc --version: 在这里插入图片描述

3.输入如下指令查看是否安装CUDA

nvcc -V

若安装完成显示下图

在这里插入图片描述 3. 查看cudnn版本

import torch print(torch.backends.cudnn.version())

下图显示:None,表示未安装成功。

在这里插入图片描述

问题:>>> import torch,torch.cuda.is_available()==False

在这里插入图片描述

cmd中检查cuda及cudnn是否成功安装及其版本 在cmd中检查cuda是否安装成功:nvcc -V 在这里插入图片描述 原文链接:https://blog.csdn.net/qq_40968179/article/details/124240224

2 .安装cuda和Pytorch 1、查看cuda版本: 在这里插入图片描述 T、具体安装看该博客:安装cuda教程,超级详细。

在cmd中检查cudnn是否安装成功:在cmd运行【C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\extras\demo_suite】路径下的bandwidthTest.exe和deviceQuery.exe,如果都能运行成功,则证明cudnn安装成功。 在这里插入图片描述

在这里插入图片描述 在这里插入图片描述 如果以上两个界面都出现,则cudnn也安装成功。

查看cudnn版本:用记事本打开cudnn.h文件,查找CUDNN_MAJOR,即可找到对应的cudnn版本。注意,如果在cudnn.h里面搜索不到,大家就去cudnn_version.h文件中搜。 具体,可参考如下: 在这里插入图片描述 我的版本应该是8.4.0 参考

1、cuda和cudann安装,安装cuda和Pytorch 2.cuda和cudann安装 3.如何在anaconda虚拟环境中安装多个版本的CUDA,cudnn,pytorch,torchvision,torchaudio及进行环境配置手把手教学

安装pytorch遇到问题:

1、Package pytorch conflicts for:在这里插入图片描述

在anaconda 虚拟环境中安装pytorch 一、创建虚拟环境

以管理员身份进入Anaconda Promot

conda create -n pyTest python=3.8

激活环境

activate pyTest

查看cuda(cudatoolkit)和cudnn版本 以上的步骤看这篇博客:https://blog.csdn.net/qq_43919533/article/details/125694437

最重要:下图是cuda:11.3对应的pytorch 遇到bug

在这里插入图片描述 在这里插入图片描述

该问题解决方法:—亲测有效!

解决方法: 1.在anaconda prompt(base)下输入以下命令: conda config --add channels conda-forge 2.再次配置pytorch的虚拟环境,输入以下命令:conda create -n pytorch python=3.8

接着执行下面的代码 conda install pytorch==1.10.0 torchvision==0.11.0 torchaudio==0.10.0 cudatoolkit=11.3 -c conda-forge

这条命令来自:https://pytorch.org/get-started/previous-versions/ 在这里插入图片描述 安装成功: 在这里插入图片描述

问题:Exception: You need either charset_normalizer or chardet installed

在这里插入图片描述

方法

在这里插入图片描述 解决raise ExceptionException: You need either charset_nornalizer or chardet installed

需要依赖库chardet或chardet-normalizer支持,尝试在安装requests前先pip install chardet,或使用这样命令安装: python -m pip install requests chardet 问题:RuntimeError: DataLoader worker (pid(s) 19340, 21256, 7988, 8180, 17600, 10208, 14972, 16948) exited unexpectedly

在这里插入图片描述 并没有显示出是哪一行代码出错,但是根据提示中的DataLoader worker可知是多线程的问题,对应到代码中应该就是下图这里:在这里插入图片描述

问题:OMP: Hint This means that multiple copies of the OpenMP runtime have been linked into the program. That is dangerous, since it can degrade performance or cause incorrect results. The best thing to do is to ensure that only a single OpenMP runtime is linked into the process, e.g. by avoiding static linking of the OpenMP runtime in any library. As an unsafe, unsupported, undocumented workaround you can set the environment variable KMP_DUPLICATE_LIB_OK=TRUE to allow the program to continue to execute, but that may cause crashes or silently produce incorrect results. For more information, please see http://www.intel.com/software/products/support/. 解决办法:=----可以解决!!!!

在代码前加入这两个代码行

import os os.environ['KMP_DUPLICATE_LIB_OK'] = 'TRUE'

在这里插入图片描述

下图中的我的解决不了

参考 :http://t.csdn.cn/gBAW8 在这里插入图片描述

问题:TypeError: No loop matching the specified signature and casting was found for ufunc greater

在这里插入图片描述

解决办法:

https://blog.csdn.net/jacke121/article/details/128888756

推荐一个找bug的网站:https://kaifa.baidu.com/


【本文地址】

公司简介

联系我们

今日新闻

    推荐新闻

    专题文章
      CopyRight 2018-2019 实验室设备网 版权所有